package com.wangp.mywrite.coding;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: wp
 * @date: 2023/5/5 18:08:00
 * @desc:
 **/
public class HardestWorker {

    public int hardestWorker(int n, int[][] logs) {
        int start = 0;
        int minId = 501;
        int maxLog = -1;
        for (int[] log : logs) {
            int i = log[0];
            int curLog = log[1] - start;
            if (curLog > maxLog) {
                maxLog = curLog;
                minId = i;
            } else if (curLog == maxLog && minId > i) {
                minId = i;
            }
            start = log[1];
        }
        return minId;
    }

    public static void main(String[] args) {
        System.out.println(new HardestWorker().hardestWorker(16, new int[][]
                {{1, 1}, {3, 7}, {2, 12}, {7, 17}}));
    }
}
